import { Entity,Column,PrimaryGeneratedColumn, OneToMany } from 'typeorm'
import { Message } from '../message/message.entity'

@Entity()
export class User {
    @PrimaryGeneratedColumn()
    id: number;

    @Column({ name: 'user_name' })
    userName: string;

    @Column()
    password: string;

    @Column({ name: 'head_pic',default: null })
    headPic: number;

    @Column({ name: 'is_online',default: 1 })
    isOnline: number;

    @OneToMany(() => Message,message => message.sendUser)
    messages: Message
}